package com.homework;

import java.util.Objects;

/**
 * 描述: 咖啡类
 * 矿泉水
 *
 * @author CodeYang
 * @version 2020/12/17 10:13
 */
public class CoffeeDrink extends Drink {
    /**
     * 配料
     */
    private String ingredients;

    public CoffeeDrink() {
    }

    public CoffeeDrink(String ingredients) {
        this.ingredients = ingredients;
    }

    public CoffeeDrink(String name, double capacity, String ingredients) {
        super(name, capacity);
        this.ingredients = ingredients;
    }

    @Override
    public void show() {
        super.show();
        System.out.println("添加配料:"+ingredients);
    }

    public String getIngredients() {
        return ingredients;
    }

    public void setIngredients(String ingredients) {
        this.ingredients = ingredients;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        CoffeeDrink that = (CoffeeDrink) o;
        return ingredients.equals(that.ingredients);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), ingredients);
    }
}
